<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Job;

use App\Service\User\OrderCouponService;
use App\Service\User\OrderService;

use Hyperf\AsyncQueue\Job;

/**
 * Class
 *
 * @author 张昊(2396675557@qq.com)
 * @package App\Job
 */
class OrderCouponTimeOutJob extends Job
{
    /**
     * @var string
     */
    public $order_no;

    /**
     * OrderCancel constructor.
     *
     * @param string $order_no
     */
    public function __construct(string $order_no)
    {
        $this->order_no = $order_no;
    }

    /**
     * Handle the job.
     */
    public function handle()
    {
        $container = \Hyperf\Utils\ApplicationContext::getContainer();
        $orderService = $container->get(OrderCouponService::class);
        $orderService->closeOrder($this->order_no, $orderService::STATUS_CLOSE, '超时自动关闭');
    }
}